/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rs_GUI;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

/**
 *
 * @author Mastroperrou
 */
public class MainMenuSidePanel extends javax.swing.JPanel {

    //Πεδία

    //private DBmanager db = new DBmanager();
    private EntityManagerFactory emf; // Το EntityManagerFactory
    private EntityManager em; // Ο EntityManager
    RadioStationParentFrame frame;

    public MainMenuSidePanel(RadioStationParentFrame frame, EntityManager em) {
        //conect();
        this.frame = frame;
        this.em = em;
        
        initComponents(); 
        songListsLabel.setVisible(false);
        fileManagementLabel.setVisible(false);
        artistsLabel.setVisible(false);
        artAlbumLabel.setVisible(false);
        grAlbumLabel.setVisible(false);
        groupsLabel.setVisible(false);

        
        JMenuBar menu = new JMenuBar();
        JMenu  jMenu1 = new JMenu("Μενού");
        
/*==Aπό εδω για το submenu =================================================*/     
        JMenu  subMenu = new JMenu("Διαχείριση Αρχείων");
        
        JMenuItem artistItem = new JMenuItem("Καλλιτέχνες");
        artistItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                artistItemActionPerformed(evt);
                fileManagementLabel.setVisible(true);
                artistsLabel.setVisible(true);
                jLabel1.setVisible(false);
                jLabel2.setVisible(false);
                jLabel3.setVisible(false);
                jLabel4.setVisible(false);
                jLabel5.setVisible(false);
            }
        });
        subMenu.add(artistItem);
        
        JMenuItem groupItem = new JMenuItem("Συγκροτήματα");
        groupItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                groupItemActionPerformed(evt);
                fileManagementLabel.setVisible(true);
                groupsLabel.setVisible(true);
                jLabel1.setVisible(false);
                jLabel2.setVisible(false);
                jLabel3.setVisible(false);
                jLabel4.setVisible(false);
                jLabel5.setVisible(false);
            }
        });
        subMenu.add(groupItem);
        
        JMenuItem groupAlbumItem = new JMenuItem("Άλμπουμ Συγκροτημάτων");
        groupAlbumItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                groupAlbumItemActionPerformed(evt);
                fileManagementLabel.setVisible(true);
                grAlbumLabel.setVisible(true);
                jLabel1.setVisible(false);
                jLabel2.setVisible(false);
                jLabel3.setVisible(false);
                jLabel4.setVisible(false);
                jLabel5.setVisible(false);
                
            }
        });
        subMenu.add(groupAlbumItem);
        
        JMenuItem artistAlbumItem = new JMenuItem("Άλμπουμ Καλλιτεχνών");
        artistAlbumItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                artistAlbumItemActionPerformed(evt);
                fileManagementLabel.setVisible(true);
                artAlbumLabel.setVisible(true);
                jLabel1.setVisible(false);
                jLabel2.setVisible(false);
                jLabel3.setVisible(false);
                jLabel4.setVisible(false);
                jLabel5.setVisible(false);
            }
        });
        subMenu.add(artistAlbumItem);        
      
        jMenu1.add(subMenu);
        
        JMenuItem songListItem = new JMenuItem("Λίστες Τραγουδιών");
        songListItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                songListItemActionPerformed(evt);
                songListsLabel.setVisible(true);
                jLabel1.setVisible(false);
                jLabel2.setVisible(false);
                jLabel3.setVisible(false);
                jLabel4.setVisible(false);
                jLabel5.setVisible(false);
            }
        });
        jMenu1.add(songListItem);
        
        JMenuItem exitItem = new JMenuItem("Έξοδος");
        exitItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitItemActionPerformed(evt);
            }
        });
        jMenu1.add(exitItem);
               
        menu.add(jMenu1);
        frame.setJMenuBar(menu);
    }

//    private void fileManageItemActionPerformed(java.awt.event.ActionEvent evt) {                                           
//        this.fileManagementjButtonActionPerformed(evt);
//        
//    }      

    private void songListItemActionPerformed(java.awt.event.ActionEvent evt) { 
        frame.addPanelInMain(new PlayLists_MainPanel(frame, em));
        frame.addPanelInSide(this);
    }  
    
    private void exitItemActionPerformed(java.awt.event.ActionEvent evt) {                                           
        //Φέρνει το EntityManagerFactory
        emf = em.getEntityManagerFactory();

        //Κλείνει τον EntityManager και το EntityManagerFactory.
        em.close();
        emf.close();

        //Κλείνει το πρόγραμμα.
        System.exit(0);
    }


    private void artistItemActionPerformed(java.awt.event.ActionEvent evt) {                                           
        frame.addPanelInMain(new Artist_MainPanel(frame, em));
        frame.addPanelInSide(this);
    }  
    
    private void groupItemActionPerformed(java.awt.event.ActionEvent evt) {                                           
        frame.addPanelInMain(new MusicGroup_MainPanel(frame));
        frame.addPanelInSide(this);
    }  
    
    private void groupAlbumItemActionPerformed(java.awt.event.ActionEvent evt) {                                           
        frame.addPanelInMain(new GroupAlbum_MainPanel(frame, em));
        frame.addPanelInSide(this);
    } 
    
    private void artistAlbumItemActionPerformed(java.awt.event.ActionEvent evt) {                                           
        frame.addPanelInMain(new ArtistAlbum_MainPanel(frame, em));
        frame.addPanelInSide(this);
    }    
/*==Μεχρι εδω για το submenu =================================================*/
  

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel6 = new javax.swing.JLabel();
        songListsLabel = new javax.swing.JLabel();
        fileManagementLabel = new javax.swing.JLabel();
        artistsLabel = new javax.swing.JLabel();
        groupsLabel = new javax.swing.JLabel();
        grAlbumLabel = new javax.swing.JLabel();
        artAlbumLabel = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();

        jLabel6.setText("jLabel6");

        setBackground(new java.awt.Color(0, 102, 153));
        setMaximumSize(new java.awt.Dimension(184, 445));
        setMinimumSize(new java.awt.Dimension(184, 445));
        setPreferredSize(new java.awt.Dimension(184, 445));

        songListsLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        songListsLabel.setForeground(new java.awt.Color(255, 255, 255));
        songListsLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        songListsLabel.setText("Λίστες τραγουδιών");

        fileManagementLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        fileManagementLabel.setForeground(new java.awt.Color(255, 255, 255));
        fileManagementLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        fileManagementLabel.setText("Διαχείριση Αρχείων:");

        artistsLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        artistsLabel.setForeground(new java.awt.Color(255, 255, 255));
        artistsLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        artistsLabel.setText("Καλλιτέχνες");

        groupsLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        groupsLabel.setForeground(new java.awt.Color(255, 255, 255));
        groupsLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        groupsLabel.setText("Συγκροτήματα");

        grAlbumLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        grAlbumLabel.setForeground(new java.awt.Color(255, 255, 255));
        grAlbumLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        grAlbumLabel.setText("<html><body>Άλμπουμ<br>Συγκροτημάτων</body></html>");
        grAlbumLabel.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

        artAlbumLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        artAlbumLabel.setForeground(new java.awt.Color(255, 255, 255));
        artAlbumLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        artAlbumLabel.setText("<html><body>Άλμπουμ<br>Καλλιτεχνών</body></html>");

        jLabel1.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText("στο RadioStation!");

        jLabel2.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Καλως ήλθατε");

        jLabel3.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Πατήστε πάνω");

        jLabel4.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("για να ξεκινήσετε.");

        jLabel5.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(255, 255, 255));
        jLabel5.setText("στο Menu");

        jLabel7.setText("ΠΛΗ 24");

        jLabel8.setText("3η ομαδική Γ.Ε.");

        jLabel9.setText("Αικατερίνη Μαστροπέρρου");

        jLabel10.setText("Σπυρίδων Λεπενιώτης");

        jLabel11.setText("Φώτιος Κόχειλας");

        jLabel12.setText("Ευάγγελος Μαρτζέλης");

        jLabel13.setText("2014 - 2015");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(fileManagementLabel)
                    .addComponent(songListsLabel)))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(artistsLabel))
                    .addComponent(groupsLabel)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel4)
                    .addComponent(grAlbumLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel5)
                    .addComponent(artAlbumLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel7))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel8))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel13))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel9))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel10))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel11))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel12))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(93, 93, 93)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(fileManagementLabel)
                    .addComponent(songListsLabel))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(artistsLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(groupsLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jLabel1))
                    .addComponent(jLabel2)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(100, 100, 100)
                        .addComponent(jLabel4))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(grAlbumLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(60, 60, 60)
                        .addComponent(jLabel3))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(80, 80, 80)
                        .addComponent(jLabel5))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(artAlbumLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(25, 25, 25)
                .addComponent(jLabel7)
                .addGap(3, 3, 3)
                .addComponent(jLabel8)
                .addGap(4, 4, 4)
                .addComponent(jLabel13)
                .addGap(15, 15, 15)
                .addComponent(jLabel9)
                .addGap(9, 9, 9)
                .addComponent(jLabel10)
                .addGap(9, 9, 9)
                .addComponent(jLabel11)
                .addGap(9, 9, 9)
                .addComponent(jLabel12))
        );
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel artAlbumLabel;
    private javax.swing.JLabel artistsLabel;
    private javax.swing.JLabel fileManagementLabel;
    private javax.swing.JLabel grAlbumLabel;
    private javax.swing.JLabel groupsLabel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel songListsLabel;
    // End of variables declaration//GEN-END:variables
}
